;;;
;;; JaCoLiB
;;; Copyright (C) 2008 Alessandro Serra
;;; 
;;; This program is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or
;;; (at your option) any later version.
;;; 
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;; 
;;; You should have received a copy of the GNU General Public License
;;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
;;;

;;;; Created on 2008-07-22 10:18:54

(in-package :jacolib)

;
; RPC Request
;

(defstruct rpc-request 
  method
  params)

; json serialization

(def-json-serializer 'rpc-request "rpc.request" 
  (aadd "method" (rpc-request-method obj))
  (aadd "params" (rpc-request-params obj)))

(def-json-deserializer "rpc.request" 
  (let* ((v1 (afind "method" 'string))
         (v2 (afind "params" 'list)))
    (setf obj (make-rpc-request :method v1 :params v2))))
